#post请求
import urllib.request
import urllib.parse
import json

url='https://fanyi.baidu.com/sug'
headers={'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0'}
data={
    'kw':'submit'
}


data=urllib.parse.urlencode(data).encode('utf-8')
request=urllib.request.Request(url=url,data=data,headers=headers)
response=urllib.request.urlopen(request)
count=response.read().decode('utf-8')
print(count)
#json.loads()将json格式转化为python格式
print(json.loads(count))